package com.base;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author: sun.hongliang
 * @create: 2019/08/10 12:08
 */
public class LinkedHashMapTest<K, V> extends LinkedHashMap<K, V> {
    private static final long serialVersionUID = -1393654819992366L;
    private int maxSize;

    public LinkedHashMapTest(int maxSize) {
        super(maxSize, 0.75f, true);
        this.maxSize = maxSize;
    }

    @Override
    protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
        return size() > maxSize;
    }
}
